﻿<html><head><style type="text/css">body {
	font-family:sans-serif;
	font-size:14px;
	line-height:1.6;
	padding-top:10px;
	padding-bottom:10px;
	background-color:white;
	padding:30px;
}
body > *:first-child {
	margin-top:0 !important;
}
body > *:last-child {
	margin-bottom:0 !important;
}
a {
	color:#4183C4;
}
a.absent {
	color:#cc0000;
}
a.anchor {
	display:block;
	padding-left:30px;
	margin-left:-30px;
	cursor:pointer;
	position:absolute;
	top:0;
	left:0;
	bottom:0;
}
h1,h2,h3,h4,h5,h6 {
	margin:20px 0 10px;
	padding:0;
	font-weight:bold;
	-webkit-font-smoothing:antialiased;
	cursor:text;
	position:relative;
}
h1:hover a.anchor,h2:hover a.anchor,h3:hover a.anchor,h4:hover a.anchor,h5:hover a.anchor,h6:hover a.anchor {
	no-repeat 10px center;
	text-decoration:none;
}
h1 tt,h1 code,h2 tt,h2 code,h3 tt,h3 code,h4 tt,h4 code,h5 tt,h5 code，h6 tt,h6 code {
	font-size:inherit;
}
h1 {
	font-size:28px;
	color:black;
}
h2 {
	font-size:24px;
	border-bottom:1px solid #cccccc;
	color:black;
}
h3 {
	font-size:18px;
}
h4 {
	font-size:16px;
}
h5 {
	font-size:14px;
}
h6 {
	color:#777777;
	font-size:14px;
}
p,blockquote,ol,dl,table,pre {
	margin:15px 0;
}
ul {
	margin:0;
}
hr {
	background:transparent repeat-x 0 0;
	border:0 none;
	color:#cccccc;
	height:4px;
	padding:0;
}
body > h2:first-child {
	margin-top:0;
	padding-top:0;
}
body > h1:first-child {
	margin-top:0;
	padding-top:0;
}
body > h1:first-child + h2 {
	margin-top:0;
	padding-top:0;
}
body > h3:first-child,body > h4:first-child,body > h5:first-child,body > h6:first-child {
	margin-top:0;
	padding-top:0;
}
a:first-child h1,a:first-child h2,a:first-child h3,a:first-child h4,a:first-child h5,a:first-child h6 {
	margin-top:0;
	padding-top:0;
}
h1 p,h2 p,h3 p,h4 p,h5 p,h6 p {
	margin-top:0;
}
li p.first {
	display:inline-block;
}
ul,ol {
	padding-left:30px;
}
ul:first-child,ol:first-child {
	margin-top:0;
}
ul:last-child,ol:last-child {
	margin-bottom:0;
}
dl {
	padding:0;
}
dl dt {
	font-size:14px;
	font-weight:bold;
	font-style:italic;
	padding:0;
	margin:15px 0 5px;
}
dl dt:first-child {
	padding:0;
}
dl dt >:first-child {
	margin-top:0;
}
dl dt >:last-child {
	margin-bottom:0;
}
dl dd {
	margin:0 0 15px;
	padding:0 15px;
}
dl dd >:first-child {
	margin-top:0;
}
dl dd >:last-child {
	margin-bottom:0;
}
blockquote {
	border-left:4px solid #dddddd;
	padding:0 15px;
	color:#777777;
}
blockquote >:first-child {
	margin-top:0;
}
blockquote >:last-child {
	margin-bottom:0;
}
table {
	border-collapse:collapse;
	padding:0;
}
table tr {
	border-top:1px solid #cccccc;
	background-color:white;
	margin:0;
	padding:0;
}
table tr:nth-child(2n) {
	background-color:#f8f8f8;
}
table tr th {
	font-weight:bold;
	border:1px solid #cccccc;
	text-align:left;
	margin:0;
	padding:6px 13px;
}
table tr td {
	border:1px solid #cccccc;
	text-align:left;
	margin:0;
	padding:6px 13px;
}
table tr th:first-child,table tr td:first-child {
	margin-top:0;
}
table tr th:last-child,table tr td:last-child {
	margin-bottom:0;
}
img {
	max-width:100%;
}
span.frame {
	display:block;
	overflow:hidden;
}
span.frame > span {
	border:1px solid #dddddd;
	display:block;
	float:left;
	overflow:hidden;
	margin:13px 0 0;
	padding:7px;
	width:auto;
}
span.frame span img {
	display:block;
	float:left;
}
span.frame span span {
	clear:both;
	color:#333333;
	display:block;
	padding:5px 0 0;
}
span.align-center {
	display:block;
	overflow:hidden;
	clear:both;
}
span.align-center > span {
	display:block;
	overflow:hidden;
	margin:13px auto 0;
	text-align:center;
}
span.align-center span img {
	margin:0 auto;
	text-align:center;
}
span.align-right {
	display:block;
	overflow:hidden;
	clear:both;
}
span.align-right > span {
	display:block;
	overflow:hidden;
	margin:13px 0 0;
	text-align:right;
}
span.align-right span img {
	margin:0;
	text-align:right;
}
span.float-left {
	display:block;
	margin-right:13px;
	overflow:hidden;
	float:left;
}
span.float-left span {
	margin:13px 0 0;
}
span.float-right {
	display:block;
	margin-left:13px;
	overflow:hidden;
	float:right;
}
span.float-right > span {
	display:block;
	overflow:hidden;
	margin:13px auto 0;
	text-align:right;
}
pre,code,tt {
	font-size:12px;
	font-family:Consolas,"Liberation Mono",Courier,monospace;
}
code,tt {
	margin:0;
	padding:0 5px;
	white-space:nowrap;
	border:1px solid #eaeaea;
	background-color:#f8f8f8;
	border-radius:3px;
}
pre code {
	margin:0;
	padding:0;
	white-space:pre;
	border:none;
	background:transparent;
}
.highlight pre {
	background-color:#f8f8f8;
	border:1px solid #cccccc;
	font-size:13px;
	line-height:19px;
	overflow:auto;
	padding:6px 10px;
	border-radius:3px;
}
pre {
	background-color:#f8f8f8;
	border:1px solid #cccccc;
	font-size:13px;
	line-height:19px;
	overflow:auto;
	padding:6px 10px;
	border-radius:3px;
}
pre code,pre tt {
	background-color:transparent;
	border:none;
}
</style></head><body><h1>一. 新闻接口</h1>

<h2>1. 头条新闻</h2>

<h3>1.1. 请求类型：GET</h3>

<pre><code>http://wiapi.hexun.com/news/gethp.php?id=100234721
</code></pre>

<h3>1.2. 返回数据类型：XML（UTF-8编码）</h3>

<p>可以使用VisualXML测试，可直接用GDataXML解析。</p>

<h2>2. 其他新闻</h2>

<h3>2.1. 请求类型：GET</h3>

<pre><code>http://wiapi.hexun.com/news/gethp2.0.php?id=[栏目参数]
</code></pre>

<h3>2.2. 栏目参数</h3>

<table><thead>
<tr>
<th>栏目名称</th>
<th align="center">栏目参数</th>
</tr>
</thead><tbody>
<tr>
<td>新闻</td>
<td align="center">100000000</td>
</tr>
<tr>
<td>股票</td>
<td align="center">100228599</td>
</tr>
<tr>
<td>基金</td>
<td align="center">101767368</td>
</tr>
<tr>
<td>期货</td>
<td align="center">101032758</td>
</tr>
<tr>
<td>期指</td>
<td align="center">101155325</td>
</tr>
<tr>
<td>黄金</td>
<td align="center">101710857</td>
</tr>
<tr>
<td>外汇</td>
<td align="center">100098426</td>
</tr>
<tr>
<td>债券</td>
<td align="center">101032723</td>
</tr>
<tr>
<td>评论</td>
<td align="center">100012296</td>
</tr>
<tr>
<td>理财</td>
<td align="center">101002114</td>
</tr>
<tr>
<td>银行</td>
<td align="center">101710894</td>
</tr>
<tr>
<td>保险</td>
<td align="center">101710721</td>
</tr>
<tr>
<td>房产</td>
<td align="center">100092115</td>
</tr>
<tr>
<td>汽车</td>
<td align="center">101931837</td>
</tr>
<tr>
<td>科技</td>
<td align="center">100052214</td>
</tr>
<tr>
<td>读书</td>
<td align="center">103147590</td>
</tr>
</tbody></table>

<h3>2.3. 返回数据类型：XML（UTF-8编码）</h3>

<p>可以使用VisualXML测试，可直接用GDataXML解析。</p>

<h2>3. 获取新闻的详细内容</h2>

<h3>3.1. 请求类型：GET</h3>

<pre><code>http://wiapi.hexun.com/news/gethp.php?id=[新闻id]
</code></pre>

<h3>3.2. 返回数据类型：XML（GBK编码）</h3>

<blockquote>
<p>注意事项：</p>
</blockquote>

<p>3.2.1. 使用VisualXML无法测试。建议使用Safari浏览器测试本条API。测试方式：用Safari打开，并选择编码方式为“简体中文”。</p>

<p>3.2.2. 解析时，先要将请求得到的数据使用GBK编码变为字符串，并去除字符串中的<code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;GBK&quot;?&gt;</code>部分，再用GDataXMLNode解析。参考代码片段：</p>

<pre><code>//GBK编码代号
NSStringEncoding GBKEncoding = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);

//使用GBK编码创建XML字符串
NSString *xmlString = [[NSString alloc] initWithData:xmlData encoding:GBKEncoding];

//去除字符串中的&lt;?xml version=&quot;1.0&quot; encoding=&quot;GBK&quot;?&gt;部分
xmlString = [xmlString stringByReplacingOccurrencesOfString:@&quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;GBK\&quot;?&gt;&quot; withString:@&quot;&quot;];
</code></pre>

<hr>

<h1>二. 市场接口</h1>

<h2>1. 获取指定id的股票列表</h2>

<h3>1.1. 请求类型：POST</h3>

<pre><code>    http://quote.wiapi.hexun.com/bstock/select
</code></pre>

<h3>1.2. 请求体格式：</h3>

<pre><code>    code=[股票id1,股票id2,...]&amp;sort=[排序依据]&amp;type=[排序方式]
</code></pre>

<blockquote>
<p>1.2.1.  参数说明</p>
</blockquote>

<table><thead>
<tr>
<th>参数</th>
<th>填写内容</th>
<th>备注</th>
</tr>
</thead><tbody>
<tr>
<td>code</td>
<td>股票的id，多个id之间用英文逗号隔开</td>
<td>股票id来自一个plist资源文件<br>（另附4个特殊的id，见附表）</td>
</tr>
<tr>
<td>sort</td>
<td>表示根据股票的何种指标进行排序</td>
<td>指标代号见附表</td>
</tr>
<tr>
<td>type</td>
<td>表示按照升序还是降序进行排序</td>
<td>0表示升序，1表示降序</td>
</tr>
</tbody></table>

<blockquote>
<p>1.2.2. 参数附表</p>
</blockquote>

<table><thead>
<tr>
<th>4个特殊的股票id</th>
</tr>
</thead><tbody>
<tr>
<td>上证指数：2318</td>
</tr>
<tr>
<td>深证指数：2185</td>
</tr>
<tr>
<td>沪深300：2131</td>
</tr>
<tr>
<td>中小板指：2213</td>
</tr>
</tbody></table>

<table><thead>
<tr>
<th>股票指标</th>
<th>代号</th>
</tr>
</thead><tbody>
<tr>
<td>最新</td>
<td>4</td>
</tr>
<tr>
<td>涨跌</td>
<td>14</td>
</tr>
<tr>
<td>涨幅%</td>
<td>15</td>
</tr>
<tr>
<td>换手</td>
<td>25</td>
</tr>
<tr>
<td>成交量</td>
<td>5</td>
</tr>
<tr>
<td>成交额</td>
<td>6</td>
</tr>
<tr>
<td>量比</td>
<td>21</td>
</tr>
<tr>
<td>涨速</td>
<td>16</td>
</tr>
<tr>
<td>振幅</td>
<td>17</td>
</tr>
<tr>
<td>昨收</td>
<td>（不详）</td>
</tr>
</tbody></table>

<h3>1.3. 返回值数据类型：Data</h3>

<blockquote>
<p>1.3.1. 返回的数据是一个二进制序列，其字节分布如下：</p>
</blockquote>

<table><thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead><tbody>
<tr>
<td>有效数据长度l<br>(int, 4字节)</td>
<td>股票总数<br>(int, 4字节)</td>
<td>占位<br>(4字节)</td>
<td>有效数据<br>(String, l字节)</td>
</tr>
</tbody></table>

<blockquote>
<p>1.3.2. 有效数据部分解析</p>
</blockquote>

<p>有效数据部分可转换成一个字符串，字符串中记录若干条的股票信息，相当于一个列表，示例如下：</p>

<pre><code>2318,3,000001,上证指数,-4268.10,-259.68,-5.74,0.00,42926万,6165.80亿,1.13,+0.37,4.94,4527.78,1;
2185,4,399001,深证成指,-14512.66,-1179.78,-7.52,0.00,25070万,4851.04亿,1.09,+0.39,5.03,15692.44,2;
2131,4,399300,沪深300,-4427.59,-278.93,-5.93,0.00,32716万,4671.09亿,1.11,+0.74,5.63,4706.52,3;
2213,4,399005,中小板指,-9351.28,-809.32,-7.97,0.00,7916万,1736.76亿,1.09,+0.32,5.39,10160.60,4
</code></pre>

<p>每条股票信息之间用英文分号（;）隔开，不含换行符。</p>

<p>每条股票信息的各个数据用英文逗号（,）隔开，这些数据依次表示（以上证指数为例）：</p>

<pre><code>股票id     股票代码   股票名称    最新         涨跌       涨幅%   换手     成交量     成交额        量比    涨速     振幅     昨收
2318,  3,  000001,  上证指数,  -4268.10,  -259.68,  -5.74,  0.00,  42926万,  6165.80亿,  1.13,  +0.37,  4.94,  4527.78,  1;
</code></pre>

<h2>2. 获取指定板块的股票列表</h2>

<h3>2.1. 请求类型：POST</h3>

<pre><code>http://quote.wiapi.hexun.com/bstock/riseFall
</code></pre>

<h3>2.2. 请求体格式</h3>

<pre><code>block=[板块id]&amp;sort=[排序依据]&amp;type=[排序方式]&amp;start=[起始条目]&amp;end=[结束条目]
</code></pre>

<blockquote>
<p>2.2.1. 参数说明：</p>
</blockquote>

<table><thead>
<tr>
<th>参数</th>
<th>填写内容</th>
</tr>
</thead><tbody>
<tr>
<td>block</td>
<td>板块id，见附表</td>
</tr>
<tr>
<td>sort、type</td>
<td>同1.2.1</td>
</tr>
<tr>
<td>start</td>
<td>指定从第几条开始加载，最小值为0</td>
</tr>
<tr>
<td>end</td>
<td>指定加载到第几条为止</td>
</tr>
</tbody></table>

<blockquote>
<p>2.2.2. 附表：</p>
</blockquote>

<table><thead>
<tr>
<th>板块名称</th>
<th>板块id</th>
</tr>
</thead><tbody>
<tr>
<td>泸深A股</td>
<td>252</td>
</tr>
<tr>
<td>泸A</td>
<td>1</td>
</tr>
<tr>
<td>深A</td>
<td>2</td>
</tr>
<tr>
<td>泸B</td>
<td>3</td>
</tr>
<tr>
<td>深B</td>
<td>4</td>
</tr>
<tr>
<td>中小板</td>
<td>5</td>
</tr>
<tr>
<td>创业板</td>
<td>6</td>
</tr>
<tr>
<td>权重股</td>
<td>23</td>
</tr>
<tr>
<td>证监会</td>
<td>248</td>
</tr>
</tbody></table>

<h3>2.3. 返回数据类型：Data</h3>

<p>数据格式与1.3相同。</p>

<h2>3. 获取一只股票的详细信息</h2>

<h3>3.1. 请求类型：GET</h3>

<pre><code>http://quote.wiapi.hexun.com/bstock/stockShare?code=[股票id]
</code></pre>

<h3>3.2. 返回数据类型：Data</h3>

<blockquote>
<p>3.2.1. 返回的数据是一个二进制序列，其字节分布如下：</p>
</blockquote>

<table><thead>
<tr>
<th></th>
<th></th>
</tr>
</thead><tbody>
<tr>
<td>有效数据长度l<br>(int, 8字节)</td>
<td>有效数据<br>(String, l字节)</td>
</tr>
</tbody></table>

<blockquote>
<p>3.2.2. 有效数据部分解析</p>
</blockquote>

<p>返回数据示例与说明：</p>

<pre><code>股票id     股票代码  股票名字   最新      涨跌   涨幅%   最高   开盘     最低   中间值  换手   成交量                股本     市值      市盈      流通     第1个时间点     成交价 成交总金额   成交总股数  第2个时间点    成交价   成交总金额  成交总股数   以此类推……
677,   1, 002224,  三 力 士,  18.00,  -0.18,  -0.99, +18.40, -17.97, -16.36, 18.18, 5.13, 22.62万, 3.82亿,1.00, 6.55亿, 117.84亿, 130.43, 79.42亿;  20150626145901,  1800,  47759544,  2653308;  20150626145601,  1840,  38849830,  2299892;    20150626145501,1636,9200864,562400;20150626145401,1636,13958352,853200;20150626145301,1636,109612,6700;20150626145201,1636,65440,4000;20150626145101,1636,15499464,947400;20150626145001,1636,49080,3000;20150626144901,1636,53988,3300;20150626144801,1636,83436,5100;20150626144701,1636,111248,6800;20150626144601,1636,139060,8500;20150626144501,1636,85072,5200;20150626144401,1636,150512,9200;20150626144301,1636,1636,100;20150626144201,1636,40900,2500;20150626144101,1636,1588556,97100;20150626144001,1636,45808,2800;20150626143601,1636,32720,2000;20150626143501,1636,3272,200;20150626143401,1636,6544,400;20150626143301,1636,89980,5500;20150626143001,1636,1636,100;20150626142901,1636,91616,5600;20150626142601,1636,333744,20400;20150626142501,1636,58896,3600;20150626142301,1636,111248,6800;20150626142101,1636,525156,32100;20150626142001,1636,27812,1700;20150626141901,1636,8180,500;20150626141801,1636,3272,200;20150626141701,1636,81800,5000;20150626141501,1636,1636,100;20150626141401,1636,4908,300;20150626141301,1636,107976,6600;20150626141201,1636,9816,600;20150626141101,1636,1636,100;20150626141001,1636,37628,2300;20150626140901,1636,81800,5000;20150626140801,1636,8180,500;20150626140701,1636,4908,300;20150626140601,1636,175052,10700;20150626140501,1636,19632,1200;20150626140401,1636,165236,10100;20150626140301,1636,503888,30800;20150626140201,1636,4908,300;20150626140101,1636,34356,2100;20150626140001,1636,696936,42600;20150626135901,1636,34356,2100;20150626135801,1636,91616,5600;20150626135701,1636,80164,4900;20150626135601,1636,548060,33500;20150626135501,1636,181596,11100;20150626135401,1636,45808,2800;20150626135301,1636,26176,1600;20150626135201,1636,1636,100;20150626135101,1636,117792,7200;20150626135001,1636,14724,900;20150626134901,1636,55624,3400;20150626134801,1636,21268,1300;20150626134601,1636,57260,3500;20150626134501,1636,14724,900;20150626134401,1636,78528,4800;20150626134301,1636,9816,600;20150626134201,1636,53988,3300;20150626134101,1636,135788,8300;20150626134001,1636,39264,2400;20150626133901,1636,17996,1100;20150626133801,1636,71984,4400;20150626133701,1636,274848,16800;20150626133601,1636,528428,32300;20150626133501,1636,60532,3700;20150626133401,1636,526792,32200;20150626133301,1636,245400,15000;20150626133201,1636,233948,14300;20150626133101,1636,3154057,192700;20150626133001,1640,812622,49500;20150626132901,1645,512376,31100;20150626132801,1650,1718565,104300;20150626132701,1647,263706,16000;20150626132601,1649,2816774,170900;20150626132501,1648,804623,49000;20150626132401,1643,1413990,85900;20150626132301,1646,419915,25500;20150626132201,1646,783642,47600;20150626132101,1648,222479,13500;20150626132001,1649,802095,48600;20150626131901,1652,824205,49800;20150626131801,1656,1140926,69100;20150626131701,1642,2682291,163100;20150626131601,1643,488123,29700;20150626131501,1645,264721,16100;20150626131401,1646,214073,13000;20150626131301,1648,210900,12800;20150626131201,1647,459419,27900;20150626131101,1647,947403,57500;20150626131001,1655,652516,39600;20150626130901,1644,250166,15200;20150626130801,1642,1895418,115239;20150626130701,1642,638326,38700;20150626130601,1651,553027,33600;20150626130501,1641,347268,21100;20150626130401,1650,514853,31200;20150626130301,1651,1136647,68700;20150626130201,1657,472259,28500;20150626130101,1658,406425,24500;20150626130001,1661,1118184,67300;20150626112901,1662,322447,19400;20150626112801,1662,355229,21400;20150626112701,1663,847907,51100;20150626112601,1659,561016,33800;20150626112501,1662,863271,52077;20150626112401,1640,3902694,235523;20150626112301,1657,8606735,521877;20150626112201,1642,2073277,125800;20150626112101,1654,1219799,73900;20150626112001,1647,962900,58400;20150626111901,1656,1061942,64200;20150626111801,1650,1249984,75600;20150626111701,1658,197435,11900;20150626111601,1660,336946,20300;20150626111501,1661,332396,20000;20150626111401,1663,595852,35800;20150626111301,1664,882523,53000;20150626111201,1664,252938,15200;20150626111101,1665,1120732,67100;20150626111001,1670,1951038,117400;20150626110901,1658,6663784,406100;20150626110801,1648,1396755,84700;20150626110701,1648,1876298,113700;20150626110601,1650,1874629,113474;20150626110501,1650,4559319,277600;20150626110401,1650,791184,47900;20150626110301,1657,1509300,91000;20150626110201,1658,367607,22200;20150626110101,1659,1126591,68400;20150626110001,1647,3653467,222000;20150626105901,1655,828053,50000;20150626105801,1658,267157,16100;20150626105701,1658,1457127,87800;20150626105601,1660,1813277,109800;20150626105501,1655,1038409,62700;20150626105401,1659,212722,12800;20150626105301,1665,818160,49200;20150626105201,1664,2338093,140600;20150626105101,1665,1540601,92700;20150626105001,1652,980994,59200;20150626104901,1653,1340982,80800;20150626104801,1661,729114,43900;20150626104701,1667,1742751,104800;20150626104601,1673,684707,41200;20150626104501,1674,2222663,133500;20150626104401,1665,307936,18426;20150626104301,1674,473989,28374;20150626104201,1670,286634,17200;20150626104101,1675,459600,27500;20150626104001,1675,150565,9000;20150626103901,1675,604886,36200;20150626103801,1673,347871,20900;20150626103701,1665,606423,36300;20150626103601,1672,592681,35500;20150626103501,1673,418236,25000;20150626103401,1673,262521,15700;20150626103301,1675,592007,35400;20150626103201,1672,606740,36300;20150626103101,1672,1044848,62600;20150626103001,1670,370927,22200;20150626102901,1672,635751,38000;20150626102801,1673,780403,46600;20150626102701,1678,273392,16300;20150626102601,1676,1210503,72200;20150626102501,1677,583986,34800;20150626102401,1678,316915,18900;20150626102301,1680,643215,38300;20150626102201,1679,546716,32561;20150626102101,1679,1500657,89500;20150626102001,1677,216393,12900;20150626101901,1676,1931798,115339;20150626101801,1674,410988,24600;20150626101701,1671,568517,33961;20150626101601,1671,620105,37039;20150626101501,1678,1179526,70300;20150626101401,1679,1950515,116061;20150626101301,1684,630937,37500;20150626101201,1684,249445,14800;20150626101101,1685,1040819,61700;20150626101001,1692,723595,42800;20150626100901,1692,682555,40300;20150626100801,1690,930691,55100;20150626100701,1688,517416,30700;20150626100601,1680,484599,28839;20150626100501,1680,316294,18800;20150626100401,1686,308734,18300;20150626100301,1688,423462,25100;20150626100201,1686,1502512,89100;20150626100101,1688,528608,31260;20150626100001,1694,405201,23940;20150626095901,1691,930447,55400;20150626095801,1679,962274,57500;20150626095701,1677,979625,58400;20150626095601,1671,917858,54700;20150626095501,1679,2590566,153660;20150626095401,1699,1848173,108940;20150626095301,1688,1083205,64900;20150626095201,1661,3685116,222200;20150626095101,1659,4162708,253100;20150626095001,1660,2134575,129300;20150626094901,1650,4697079,284490;20150626094801,1662,1743313,105200;20150626094701,1655,3473275,210500;20150626094601,1650,3897309,235900;20150626094501,1653,2141345,128900;20150626094401,1680,6265704,377976;20150626094301,1680,4220931,251500;20150626094201,1699,4192488,249900;20150626094101,1680,4095290,242300;20150626094001,1698,5729447,335200;20150626093901,1717,2987228,175100;20150626093801,1685,10224570,609039;20150626093701,1650,3352106,201800;20150626093601,1680,8573838,500700;20150626093501,1722,2532633,146500;20150626093401,1734,7194272,413600;20150626093301,1740,4435684,254700;20150626093201,1745,3454809,197800;20150626093101,1748,5971702,340800;20150626093001,1760,10815290,606300
</code></pre>

<p>注1：实际返回的数据中，逗号和分号之间没有空格。</p>

<p>注2：上述“成交价”的单位为“分”。而实际画线时一般用“元”作为单位，即要将数据中的“成交价”除以100；</p>

<p>注3：实时成交均价（即每一个时间点的成交均价）= 成交总金额 ÷ 成交总股数。</p>

<p>注4：每一个时间点的k线值 = 成交总股数 ÷ 100。</p>

<hr>

<h1>三. 行情接口</h1>

<h2>1. “全球股指”接口：</h2>

<h3>1.1. 请求类型：GET</h3>

<pre><code>http://wiapi.hexun.com/hq/gi.php
</code></pre>

<h3>1.2. 返回数据类型：XML（GB2312编码）</h3>

<blockquote>
<p>注意事项：</p>
</blockquote>

<p>1.2.1. 使用VisualXML无法测试。建议使用Safari浏览器测试本条API。测试方式：用Safari打开，并选择编码方式为“简体中文”。</p>

<p>1.2.2. 解析时，先要将请求得到的数据使用GBK编码变为字符串，并去除字符串中的<code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;GB2312&quot;?&gt;</code>部分，才能用GDataXML解析。参考代码片段：</p>

<pre><code>//GBK编码代号
NSStringEncoding GBKEncoding = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);

//使用GBK编码创建XML字符串
NSString *xmlString = [[NSString alloc] initWithData:xmlData encoding:GBKEncoding];

//去除字符串中的&lt;?xml version=&quot;1.0&quot; encoding=&quot;GB2312&quot;?&gt;部分
xmlString = [xmlString stringByReplacingOccurrencesOfString:@&quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;GB2312\&quot;?&gt;&quot; withString:@&quot;&quot;];
</code></pre>

<p>1.2.3. 部分节点含义解释</p>

<table><thead>
<tr>
<th>节点</th>
<th>含义</th>
</tr>
</thead><tbody>
<tr>
<td>fld_index</td>
<td>指标名称</td>
</tr>
<tr>
<td>fld_value</td>
<td>最新价</td>
</tr>
<tr>
<td>fld_change</td>
<td>涨跌值</td>
</tr>
<tr>
<td>fld_rate</td>
<td>涨跌幅</td>
</tr>
<tr>
<td>fld_time</td>
<td>行情时间</td>
</tr>
</tbody></table>

<h2>2. “外盘期货”接口</h2>

<h3>2.1. 请求类型：GET</h3>

<pre><code>http://wiapi.hexun.com/hq/wft.php
</code></pre>

<h3>2.2. 返回数据类型：String</h3>

<p>String中包含多条行情，每条行情之间以“|”分隔。一条行情里面的各项数据以英文逗号分隔。示例如下：</p>

<pre><code>         指标名称    最新价                                                 涨跌值                           涨跌幅   行情时间                     第二条行情以此类推
GC.gft, CBOT黄金,  1171.80,1173.70,1172.60,1178.00,1167.10,11417, 1.90,  1173.00,0,1174.90,0,  0.16,  2015-06-27 05:14:59  |  SI.gft,CBOT白银,15.81,15.74,15.81,15.86,15.45,1487,-0.07,15.70,0,15.78,0,-0.44,2015-06-27 05:14:58|CAD.gft,LME铜3个月,5770.00,5792.50,5755.50,5820.00,5741.50,4302,22.50,5789.00,0,5793.00,0,0.39,2015-06-27 01:59:53|AHD.gft,LME铝3个月,1723.00,1704.00,1720.00,1725.50,1703.50,873,-19.00,1704.00,0,1709.00,0,-1.10,2015-06-27 03:00:00|ZSD.gft,LME锌3个月,2036.00,2027.00,2042.00,2045.00,1709.00,1303,-9.00,2025.50,0,2029.00,0,-0.44,2015-06-27 01:53:26|SND.gft,LME锡3个月,14880.00,14875.00,15000.00,15000.00,14750.00,68,-5.00,14820.00,0,14875.00,0,-0.03,2015-06-27 00:52:29|PBD.gft,LME铅3个月,1792.00,1780.50,1800.50,1806.00,1773.50,796,-11.50,1780.50,0,1783.50,0,-0.64,2015-06-27 01:59:57|NID.gft,LME镍3个月,12700.00,12435.00,12725.00,12800.00,12400.00,1095,-265.00,12410.00,0,12440.00,0,-2.09,2015-06-27 01:59:48|CL.gft,NYMEX原油,59.70,59.65,59.65,59.96,58.76,20213,-0.05,59.59,0,59.64,0,-0.08,2015-06-27 05:14:57|NG.gft,NYMEX天然气,2.87,2.77,2.84,2.85,2.74,243,-0.10,2.77,0,2.77,0,-3.48,2015-06-27 06:14:26|OIL.gft,布伦特原油,63.20,63.26,63.34,63.62,62.50,18757,0.06,63.05,14,63.09,2,0.09,2015-06-27 06:13:18|C.gft,CBOT-玉米,382.75,391.75,382.25,397.00,382.00,7388,9.00,392.00,0,392.00,0,2.35,2015-06-27 02:33:35|W.gft,CBOT-小麦,538.00,568.00,537.75,572.00,536.00,8304,30.00,564.00,0,564.00,0,5.58,2015-06-27 02:30:35|S.gft,CBOT-黄豆,987.00,997.75,987.00,1011.25,985.00,3461,10.75,1003.00,0,996.50,0,1.09,2015-06-27 02:30:32|CT.gft,NYBOT-棉花,0.00,0.00,0.00,0.00,0.00,,0.00,0.00,,0.00,,0.00, |LHC.gft,CME-瘦肉猪,74.65,75.45,74.90,75.80,74.50,754,0.80,74.85,0,75.65,0,1.07,2015-06-27 02:54:58|EC.gft,IMM-欧元,1.1214,1.1180,1.1211,1.1232,1.1141,12098,-0.0034,1.1170,0,1.1190,0,-0.30,2015-06-27 04:59:54|BP.gft,IMM-英镑,1.5724,1.5737,1.5735,1.5758,1.5700,6808,0.0013,1.5701,0,1.5755,0,0.08,2015-06-27 05:59:02|JY.gft,IMM-日元,0.8097,0.8079,0.8096,0.8123,0.8072,5803,-0.0018,0.8078,0,0.8095,0,-0.22,2015-06-27 05:01:05|CD.gft,IMM-加元,0.8108,0.8108,0.8101,0.8112,0.8056,2512,0.0000,0.8100,0,0.8117,0,0.00,2015-06-27 04:59:49|SF.gft,IMM-瑞郎,1.0710,1.0742,1.0711,1.0784,1.0698,4567,0.0032,1.0700,0,1.0800,0,0.30,2015-06-27 04:58:43|DJS.gft,道指期货,0.00,0.00,0.00,0.00,0.00,,0.00,0.00,,0.00,,0.00, |ES.gft,标普期货,2093.90,2095.70,2094.50,2100.30,2086.50,285,1.80,2095.70,0,2096.10,0,0.09,2015-06-27 05:14:00|NAS.gft,纳指期货,0.00,0.00,0.00,0.00,0.00,,0.00,0.00,,0.00,,0.00, 
</code></pre>

<h2>3. “外汇行情”接口</h2>

<h3>3.1. 请求类型：GET</h3>

<pre><code>http://wiapi.hexun.com/hq/fxquote.php
</code></pre>

<h3>3.2. 返回数据类型：XML（GB2312编码）</h3>

<blockquote>
<p>注意事项：</p>
</blockquote>

<p>3.2.1. 使用VisualXML无法测试。建议使用Safari浏览器测试本条API。测试方式：用Safari打开，并选择编码方式为“简体中文”。</p>

<p>3.2.2. 解析时，先要将请求得到的数据使用GBK编码变为字符串，并去除字符串中的<code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;GB2312&quot;?&gt;</code>部分，才能用GDataXML解析。参考代码片段：</p>

<pre><code>//GBK编码代号
NSStringEncoding GBKEncoding = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);

//使用GBK编码创建XML字符串
NSString *xmlString = [[NSString alloc] initWithData:xmlData encoding:GBKEncoding];

//去除字符串中的&lt;?xml version=&quot;1.0&quot; encoding=&quot;GB2312&quot;?&gt;部分
xmlString = [xmlString stringByReplacingOccurrencesOfString:@&quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;GB2312\&quot;?&gt;&quot; withString:@&quot;&quot;];
</code></pre>

<p>3.2.3. 部分节点含义解释</p>

<table><thead>
<tr>
<th>节点</th>
<th>含义</th>
</tr>
</thead><tbody>
<tr>
<td>Name</td>
<td>指标名称</td>
</tr>
<tr>
<td>Price</td>
<td>最新价</td>
</tr>
<tr>
<td>UpDownRate</td>
<td>涨跌值</td>
</tr>
<tr>
<td>UpdownPrice</td>
<td>涨跌幅</td>
</tr>
<tr>
<td>Time</td>
<td>行情时间</td>
</tr>
</tbody></table>

<h2>4. “基金净值”接口</h2>

<h3>4.1. 请求类型：GET</h3>

<pre><code>http://wiapi.hexun.com/fund/stocknv.php
</code></pre>

<h3>4.2. 返回数据类型：XML（UTF-8编码）</h3>

<p>可以使用VisualXML测试，可直接用GDataXML解析。</p>

<p>部分节点含义解释：</p>

<table><thead>
<tr>
<th>节点</th>
<th>含义</th>
</tr>
</thead><tbody>
<tr>
<td>name</td>
<td>指标名称</td>
</tr>
<tr>
<td>net</td>
<td>最新价</td>
</tr>
<tr>
<td>unit</td>
<td>涨跌值</td>
</tr>
<tr>
<td>rate</td>
<td>涨跌幅</td>
</tr>
<tr>
<td>time</td>
<td>行情时间</td>
</tr>
</tbody></table>

<hr>

<h1>四. 图片新闻接口</h1>

<h2>1. 请求类型：GET</h2>

<pre><code>http://wiapi.hexun.com/news/gethp.php?id=[栏目参数]
</code></pre>

<table><thead>
<tr>
<th>栏目名称</th>
<th align="center">栏目参数</th>
</tr>
</thead><tbody>
<tr>
<td>股票图片</td>
<td align="center">132138528</td>
</tr>
<tr>
<td>汽车图片</td>
<td align="center">126595734</td>
</tr>
<tr>
<td>房产图片</td>
<td align="center">126649497</td>
</tr>
<tr>
<td>综合图片</td>
<td align="center">126595066</td>
</tr>
</tbody></table>

<h2>2. 返回数据类型：XML（UTF-8）编码</h2>

<p>可以使用VisualXML测试，可直接用GDataXML解析。</p>

<h1>五. 视频新闻接口</h1>

<h2>1. 获取视频新闻列表</h2>

<h3>1.1. 请求类型：GET</h3>

<pre><code>http://wiapi.hexun.com/news/gethp.php?id=[栏目参数]
</code></pre>

<table><thead>
<tr>
<th>栏目名称</th>
<th align="center">栏目参数</th>
</tr>
</thead><tbody>
<tr>
<td>证券交易</td>
<td align="center">123740700</td>
</tr>
<tr>
<td>财经热点</td>
<td align="center">129580746</td>
</tr>
<tr>
<td>投资理财</td>
<td align="center">123740949</td>
</tr>
<tr>
<td>高端访谈</td>
<td align="center">124772640</td>
</tr>
<tr>
<td>品质生活</td>
<td align="center">123816032</td>
</tr>
</tbody></table>

<h3>1.2. 返回数据类型：XML（UTF-8编码）</h3>

<p>可以使用VisualXML测试，可直接用GDataXML解析。</p>

<h2>2. 获取单条视频新闻的视频</h2>

<h3>2.1. 请求类型：GET</h3>

<pre><code>http://wiapi.hexun.com/news/gethp.php?id=[视频新闻id]
</code></pre>

<h3>2.2. 返回数据类型：XML（GBK编码）</h3>

<blockquote>
<p>注意事项：</p>
</blockquote>

<p>2.2.1. 使用VisualXML无法测试。建议使用Safari浏览器测试本条API。测试方式：用Safari打开，并选择编码方式为“简体中文”。</p>

<p>2.2.2. 解析时，先要将请求得到的数据使用GBK编码变为字符串，并去除字符串中的<code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;GBK&quot;?&gt;</code>部分，再用GDataXMLNode解析。参考代码片段：</p>

<pre><code>//GBK编码代号
NSStringEncoding GBKEncoding = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);

//使用GBK编码创建XML字符串
NSString *xmlString = [[NSString alloc] initWithData:xmlData encoding:GBKEncoding];

//去除字符串中的&lt;?xml version=&quot;1.0&quot; encoding=&quot;GBK&quot;?&gt;部分
xmlString = [xmlString stringByReplacingOccurrencesOfString:@&quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;GBK\&quot;?&gt;&quot; withString:@&quot;&quot;];
</code></pre>

<p>通过解析XML，获取视频的URL。</p>
</body></html>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    